﻿/**
 * @file		dd_pmc_uart.h
 * @brief		Clock asynchronous serial interface driver
 * @note		None
 * @attention	None
 * 
 * <B><I>Copyright 2016 Socionext Inc.</I></B>
 */

/** @weakgroup dd_pmc_uart_overview
@{
	CM0 PMC - UART Driver.<br>
	<br>
	The number of channels is 1 (ch0).
@}*//* --- end of dd_pmc_uart_overview */

/** @weakgroup dd_pmc_uart_sequence
@{
	- @ref dd_pmc_uart_sequence_sect
	- @ref dd_pmc_UART_Sample
	@section dd_pmc_uart_sequence_sect		Sequence example of UART.
	@image html dd_pmc_uart.png
	@section dd_pmc_UART_Sample Sample of UART
	@code
	static unsigned char line_buff[256];
	static short in_pos = 0;
	static short out_pos = 0;

	VOID sample_uart()
	{
		INT32	result;
		T_DD_PMC_UART_MNG uart_mng;
		CHAR sample1[] = "sample1\n";
		CHAR sample2[] = "sample2\n";
		UINT32 length;

		uart_mng.baud_rate = E_DD_PMC_UART_BAUD_RATE_57600;			// Baud rate
		uart_mng.receive_buff_addr = &gUart_r_buff[0];				// Receive buffer address
		uart_mng.receive_buff_size = sizeof(gUart_r_buff);			// Receive buffer size
		uart_mng.send_buff_addr = &gUart_s_buff[0];					// Send buffer address
		uart_mng.send_buff_size = sizeof(gUart_s_buff);				// Send buffer size
		uart_mng.auto_echo = E_DD_PMC_UART_AUTO_ECHO_OFF;			// Auto Echo
		uart_mng.save_buff = E_DD_PMC_UART_SAVE2BUFFER_EN;			// Save to the buffer
		uart_mng.mode = E_DD_PMC_UART_MODE_NORMAL;					// UART Normal Mode
		uart_mng.bit_direction = E_DD_PMC_UART_BIT_DIR_LSB_FIRST;	// Transferring Direction, LSB first or MSB first
		uart_mng.stop_bit_length = E_DD_PMC_UART_STOP_BIT_1;		// Stop bit length
		uart_mng.data_length = E_DD_PMC_UART_DATA_LENGTH_8;			// Data Length
		uart_mng.parity_bit = E_DD_PMC_UART_PARITY_BIT_NONE;		// Parity bit type
		uart_mng.inv_nrz = 0;										// NRZ
		uart_mng.fifo_ctrl = NULL;									// FIFO Setting

		Dd_PMC_UART_Ctrl( &uart_mng );
		Dd_PMC_UART_Start( NULL, sample_receive_cb );

		// Transfer process (sample1)
		length = strlen(sample1);
		for(count = 0; count < length; count++) {
			Dd_PMC_UART_Put_Char( sample1[count] );
		}

		// Transfer process (sample2)
		length = strlen(sample2);
		for(count = 0; count < length; count++) {
			Dd_PMC_UART_Set_Str( sample2[count] );
		}
		Dd_PMC_UART_Put_Str();
	}

	VOID sample_receive_cb(VOID const *const r_result)
	{
		INT32 result;
		CHAR  receive_data;

		result = (*(INT32*)r_result);
		if(result == D_DDIM_OK){
			Dd_PMC_UART_Get_Char( &receive_data );
			line_buff[in_pos++] = receive_data;
		}
	}
	@endcode

@}*//* --- end of dd_pmc_uart_sequence */

#ifndef _DD_PMC_UART_H_
#define _DD_PMC_UART_H_

/** @weakgroup dd_pmc_uart_definition
@{*/

#include "driver_common.h"

/*----------------------------------------------------------------------*/
/* Definition															*/
/*----------------------------------------------------------------------*/
//---------------------------- driver section ----------------------------
/* Return value of UART processing result */
#define D_DD_PMC_UART_INPUT_PARAM_ERROR	(D_DD_PMC_UART | D_DDIM_INPUT_PARAM_ERROR)	/**< Input parameter error.												*/
#define D_DD_PMC_UART_NO_RECEIVE		(D_DD_PMC_UART | D_DDIM_NO_RECEIVE)			/**< Receive data none.													*/
#define D_DD_PMC_UART_OVERFLOW_ERROR	(D_DD_PMC_UART | D_DDIM_OVERFLOW_ERR)		/**< Overflow error.													*/
#define D_DD_PMC_UART_NO_SEND_DATA		(D_DD_PMC_UART | D_DDIM_NO_SEND_DATA)		/**< Send data none.													*/
#define D_DD_PMC_UART_PARITY_ERROR		(D_DD_PMC_UART | D_DDIM_PARITY_DATA)		/**< Parity error.														*/
#define D_DD_PMC_UART_OVERRUN_ERROR		(D_DD_PMC_UART | D_DDIM_OVERRUN_DATA)		/**< Over-run error.													*/
#define D_DD_PMC_UART_FRAMING_ERROR		(D_DD_PMC_UART | D_DDIM_FRAMING_DATA)		/**< Framing error.														*/
#define D_DD_PMC_UART_DATA_EXIST_ERROR	(D_DD_PMC_UART | D_DDIM_DATA_EXIST_ERROR)	/**< UART exist data in send fifo when save the send FIFO read pointer.	*/
#define D_DD_PMC_UART_OVERWRITE_ERROR	(D_DD_PMC_UART | D_DDIM_OVERWRITE_ERROR)	/**< UART saved data was already overwritten.							*/
#define D_DD_PMC_UART_RECV_ENTER		(D_DD_PMC_UART | 0x100)						/**< UART recieved enter code(0x0D or 0x0A).							*/
#define D_DD_PMC_UART_RECV_CHAR			(D_DD_PMC_UART | 0x200)						/**< UART recieved character.											*/
#define D_DD_PMC_UART_RECV_SLAVE_ADDR	(D_DD_PMC_UART | 0x400)						/**< UART recieved slave address.										*/
#define D_DD_PMC_UART_FORCE_STOP		(D_DD_PMC_UART | 0x1000)					/**< UART Forced stop by Dd_PMC_UART_Stop()									*/
#define D_DD_PMC_UART_MODE_UNMATCH		(D_DD_PMC_UART | 0x2000)					/**< mode unmacth														*/
#define D_DD_PMC_UART_STOPPED			(D_DD_PMC_UART | 0x4000)					/**< Writing in the UART is stopped										*/

/* [UART] exclusion mode */
#define D_DD_PMC_USIO_EXC_OFF			(0)										/**< Not execution. (UART)	*/
#define D_DD_PMC_USIO_EXC_UART			(1)										/**< UART execution. (UART)	*/

// Rest FIFO SELECT
#define D_DD_PMC_UART_SELECT_FIFO_1		(1)										/**< Reset FIFO1.			*/
#define D_DD_PMC_UART_SELECT_FIFO_2		(2)										/**< Reset FIFO2.			*/
#define D_DD_PMC_UART_SELECT_FIFO_BOTH	(3)										/**< Reset FIFO1 and FIFO2.	*/

// UART callback status
#define D_DD_PMC_UART_INT_STATUS_RECV_CHAR			(D_DD_PMC_UART | 0x0000)		/**< recieved character		*/
#define D_DD_PMC_UART_INT_STATUS_RECV_ENTER			(D_DD_PMC_UART | 0x0001)		/**< recieved enter			*/
#define D_DD_PMC_UART_INT_STATUS_RECV_SLAVE_ADDR	(D_DD_PMC_UART | 0x0002)		/**< recieved slave address	*/
#define D_DD_PMC_UART_INT_STATUS_OVERRUN_ERROR		(D_DD_PMC_UART | 0x0003)		/**< overrun error			*/
#define D_DD_PMC_UART_INT_STATUS_FRAMING_ERROR		(D_DD_PMC_UART | 0x0004)		/**< framing error			*/
#define D_DD_PMC_UART_INT_STATUS_PARITY_ERROR		(D_DD_PMC_UART | 0x0005)		/**< parity error			*/

#ifdef CO_DDIM_UTILITY_USE
//---------------------------- utility section ---------------------------
// Nothing Special
//---------------------------- colabo section ----------------------------
// Nothing Special
#endif

/*----------------------------------------------------------------------*/
/* Enumeration															*/
/*----------------------------------------------------------------------*/
//---------------------------- driver section ----------------------------
/** Baud rate selection. */
typedef enum{
	E_DD_PMC_UART_BAUD_RATE_1200	= 1200,			/**< Baud rate:1200 */
	E_DD_PMC_UART_BAUD_RATE_2400	= 2400,			/**< Baud rate:2400 */
	E_DD_PMC_UART_BAUD_RATE_4800	= 4800,			/**< Baud rate:4800 */
	E_DD_PMC_UART_BAUD_RATE_9600	= 9600,			/**< Baud rate:9600 */
	E_DD_PMC_UART_BAUD_RATE_14400	= 14400,		/**< Baud rate:14400 */
	E_DD_PMC_UART_BAUD_RATE_19200	= 19200,		/**< Baud rate:19200 */
	E_DD_PMC_UART_BAUD_RATE_38400	= 38400,		/**< Baud rate:38400 */
	E_DD_PMC_UART_BAUD_RATE_57600	= 57600,		/**< Baud rate:57600 */
	E_DD_PMC_UART_BAUD_RATE_115200	= 115200,		/**< Baud rate:115200 */
}E_DD_PMC_UART_BAUD_RATE;

/** UART mode selection. */
typedef enum{
	E_DD_PMC_UART_MODE_NORMAL		= 0,			/**< Asynchronization normal mode */
	E_DD_PMC_UART_MODE_MULTI						/**< Asynchronization multiprocessor mode */
} E_DD_PMC_UART_MODE;

/** Transferring direction selection. */
typedef enum {
	E_DD_PMC_UART_BIT_DIR_LSB_FIRST	= 0,			/**< LSB first */
	E_DD_PMC_UART_BIT_DIR_MSB_FIRST					/**< MSB first */
} E_DD_PMC_UART_BIT_DIR;

/** Data length selection. */
typedef enum{
	E_DD_PMC_UART_DATA_LENGTH_8		= 0,			/**< 8 bit length */
	E_DD_PMC_UART_DATA_LENGTH_5, 					/**< 5 bit length */
	E_DD_PMC_UART_DATA_LENGTH_6, 					/**< 6 bit length */
	E_DD_PMC_UART_DATA_LENGTH_7, 					/**< 7 bit length */
} E_DD_PMC_UART_DATA_LENGTH;

/** Parity bit type selection. */
typedef enum {
	E_DD_PMC_UART_PARITY_BIT_NONE	= 0,			/**< Presence of parity addition: Parity none */
	E_DD_PMC_UART_PARITY_BIT_EVEN,					/**< Presence of parity addition: Parity even number */
	E_DD_PMC_UART_PARITY_BIT_ODD					/**< Presence of parity addition: Parity odd number */
} E_DD_PMC_UART_PARITY_BIT;

/** Stop bit length selection. */
typedef enum {
	E_DD_PMC_UART_STOP_BIT_1		= 0,			/**< 1 bit */
	E_DD_PMC_UART_STOP_BIT_2						/**< 2 bit */
} E_DD_PMC_UART_STOP_BIT;

/** Auto Echo selection. */
typedef enum {
	E_DD_PMC_UART_AUTO_ECHO_ON		= 0,			/**< Auto echo ON */
	E_DD_PMC_UART_AUTO_ECHO_OFF						/**< Auto echo OFF */
} E_DD_PMC_UART_AUTO_ECHO;

/** Settings for saving received data */
typedef enum {
	E_DD_PMC_UART_SAVE2BUFFER_EN	= 0,			/**< Save to the buffer */
	E_DD_PMC_UART_SAVE2BUFFER_DIS					/**< Do not save to the buffer */
} E_DD_PMC_UART_SAVE2BUFFER;

#ifdef CO_DDIM_UTILITY_USE
//---------------------------- utility section ---------------------------
// Nothing Special
//---------------------------- colabo section ----------------------------
// Nothing Special
#endif

/*----------------------------------------------------------------------*/
/* Structure															*/
/*----------------------------------------------------------------------*/
//---------------------------- driver section ----------------------------
/** FIFO control table structure */
typedef struct{
	UCHAR					fsel;				/**< FIFO selection bit	(0:send-1,receive-2	1:send-2,receive1) */
	UCHAR					fe1;				/**< FIFO 1 enable bit	(0:disable	1:enable) */
	UCHAR					fe2;				/**< FIFO 2 enable bit	(0:disable	1:enable) */
	USHORT					fbyte_recv;			/**< Receive data size (byte) */
	UCHAR					fset;				/**< FIFO transfer reload pointer storing bit	(0:no storing	1:storing) */
	UCHAR					flste;				/**< Data-lost check permmision bit	(0:no check	1:check) */
} T_DD_PMC_UART_FIFO_CTRL;

/** UART management table structure */
typedef struct {
	E_DD_PMC_UART_BAUD_RATE		baud_rate;			/**< Baud rate */
	UCHAR*						receive_buff_addr;	/**< Receive buffer address */
	UINT32						receive_buff_size;	/**< Receive buffer size */
	UCHAR*						send_buff_addr;		/**< Send buffer address */
	UINT32						send_buff_size;		/**< Send buffer size */
	E_DD_PMC_UART_AUTO_ECHO		auto_echo;			/**< Auto echo */
	E_DD_PMC_UART_SAVE2BUFFER	save_buff;			/**< Save to the buffer */

	E_DD_PMC_UART_MODE			mode;				/**< UART Mode, Normal or Multi */
	E_DD_PMC_UART_BIT_DIR		bit_direction;		/**< Transferring Direction, LSB first or MSB first */
	E_DD_PMC_UART_STOP_BIT		stop_bit_length;	/**< Stop bit length */
	E_DD_PMC_UART_PARITY_BIT	parity_bit;			/**< Parity bit type */
	E_DD_PMC_UART_DATA_LENGTH	data_length;		/**< Data Length */
	UCHAR						inv_nrz;			/**< Inversion serial data format (0:NRZ, 1:NRZ-Inversion) */

	T_DD_PMC_UART_FIFO_CTRL*	fifo_ctrl;			/**< FIFO control table */
} T_DD_PMC_UART_MNG;

#ifdef CO_DDIM_UTILITY_USE
//---------------------------- utility section ---------------------------
/** UART control table structure
 * @remarks This is for utility
 */
typedef struct {
	E_DD_PMC_UART_BAUD_RATE		baud_rate;			/**< Baud rate */
	UCHAR*						receive_buff_addr;	/**< Receive buffer address */
	UINT32						receive_buff_size;	/**< Receive buffer size */
	UCHAR*						send_buff_addr;		/**< Send buffer address */
	UINT32						send_buff_size;		/**< Send buffer size */
	E_DD_PMC_UART_AUTO_ECHO		auto_echo;			/**< Auto echo */
	E_DD_PMC_UART_SAVE2BUFFER	save_buff;			/**< Save to the buffer */
	E_DD_PMC_UART_STOP_BIT		stop_bit_length;	/**< Stop bit length */
	E_DD_PMC_UART_DATA_LENGTH	data_length;		/**< Data Length */
	E_DD_PMC_UART_PARITY_BIT	parity_bit;			/**< Parity bit type */
} T_DD_PMC_UART_MNG_SIMPLE;

//---------------------------- colabo section ----------------------------
// Nothing Special
#endif

/*----------------------------------------------------------------------*/
/* Global Data															*/
/*----------------------------------------------------------------------*/
//---------------------------- driver section ----------------------------
// Nothing Special

#ifdef CO_DDIM_UTILITY_USE
//---------------------------- utility section ---------------------------
// Nothing Special
//---------------------------- colabo section ----------------------------
// Nothing Special
#endif

/*----------------------------------------------------------------------*/
/* Macro																*/
/*----------------------------------------------------------------------*/
//---------------------------- driver section ----------------------------
// Nothing Special

#ifdef CO_DDIM_UTILITY_USE
//---------------------------- utility section ---------------------------
// Nothing Special
//---------------------------- colabo section ----------------------------
// Nothing Special
#endif

/* @} */	// dd_pmc_uart_definition group

/** @weakgroup dd_pmc_uart_api
@{*/
/*----------------------------------------------------------------------*/
/* Function																*/
/*----------------------------------------------------------------------*/
//---------------------------- driver section ----------------------------
#ifdef __cplusplus
extern "C" {
#endif

/**
The value specified by the argument is set to the register of UART.<br>
User entry function for transmission/reception specified by the argument is maintained.<br>
Reception buffer address/size of the reception buffer specified by the argument is assumed to be UART receive data storage area.<br>
@param [in]	uart_mng	UART management table. See @ref T_DD_PMC_UART_MNG.
@retval		D_DDIM_OK						: OK
@retval		D_DD_PMC_UART_INPUT_PARAM_ERROR	: Input parameter error
@remarks	When the transmission/reception callback function is NULL, the transmission/reception interrupt is prohibited.
*/
extern INT32 Dd_PMC_UART_Ctrl( T_DD_PMC_UART_MNG const* const uart_mng );

/**
The value specified by the argument is get from the register of UART.
@param [in]	uart_mng	UART management table. See @ref T_DD_PMC_UART_MNG.
@retval		D_DDIM_OK						: OK
@retval		D_DD_PMC_UART_INPUT_PARAM_ERROR	: Input parameter error
*/
extern INT32 Dd_PMC_UART_Get_Ctrl( T_DD_PMC_UART_MNG* const uart_mng );

/**
Set UART baudrate.
@param [in]	baud_rate	Baud rate reload counter value(>=4)
@retval		D_DDIM_OK						: OK
@retval		D_DD_PMC_UART_INPUT_PARAM_ERROR	: Input parameter error
*/
extern INT32 Dd_PMC_UART_Set_Baudrate( USHORT baud_rate );

/**
Get UART baudrate.
@param [out]	baud_rate	Baud rate reload counter value
@retval		D_DDIM_OK					: OK
@retval		D_DD_PMC_UART_INPUT_PARAM_ERROR	: Input parameter error
*/
extern INT32 Dd_PMC_UART_Get_Baudrate( USHORT* baud_rate );

/**
The UART baudrate is reset.
@retval		D_DDIM_OK						: OK
@retval		D_DD_PMC_UART_INPUT_PARAM_ERROR	: Input parameter error
*/
INT32 Dd_PMC_UART_Reset_Baudrate( VOID );

/**
Save the send FIFO read pointer.<br>
Read pointer is used in order to resend, when a communication fault occur.
@param [in]		lost_detect	Reload data lost detect enable (0:detect disable, 1:detect enable)
@retval		D_DDIM_OK						: OK
@retval		D_DD_PMC_UART_INPUT_PARAM_ERROR	: Input parameter error
@retval		D_DD_PMC_UART_DATA_EXIST_ERROR	: Exist data in send fifo. Wait to complete transmission.
@remarks	Please don't call this API during transmission.
*/
extern INT32 Dd_PMC_UART_Save_Send_FIFO_Pointer( UCHAR lost_detect );

/**
Reload the data saved by the @ref Dd_PMC_UART_Save_Send_FIFO_Pointer to a read pointer.
@retval		D_DDIM_OK						: OK
@retval		D_DD_PMC_UART_INPUT_PARAM_ERROR	: Input parameter error
@retval		D_DD_PMC_UART_OVERWRITE_ERROR	: Saved data was already overwritten.<br>
										  Please reset FIFO and retry transmitting processing.
@remarks
			- Please don't call this API during transmission.
			- Please don't transmit after reloading in this API until reloading finishes.
			- This API cannot be used in a full-duplex communication.
*/
extern INT32 Dd_PMC_UART_Reload_Send_FIFO_Pointer( VOID );

/**
Get reload status.
@retval		D_DDIM_OK						: OK
@retval		D_DD_PMC_UART_INPUT_PARAM_ERROR	: Input parameter error
@retval		0								: Not reload.
@retval		1								: Reloading.
@remarks	Please don't transmit after reloading in this API until reloading finishes.
*/
extern INT32 Dd_PMC_UART_Get_Reload_Status( VOID );

/**
Reset FIFO.
@param [in]		fifo_num	FIFO select (@ref D_DD_PMC_UART_SELECT_FIFO_1 or @ref D_DD_PMC_UART_SELECT_FIFO_2 or @ref D_DD_PMC_UART_SELECT_FIFO_BOTH)
@retval		D_DDIM_OK						: OK
@retval		D_DD_PMC_UART_INPUT_PARAM_ERROR	: Input parameter error
@remarks	Please don't call this API during transmission.
*/
extern INT32 Dd_PMC_UART_Reset_FIFO( UCHAR fifo_num );

/**
The UART sending and receiving processing begins.
@param [in]		psend_callback		Send callback function pointer
@param [in]		preceive_callback	Receive callback function pointer
@retval		D_DDIM_OK						: OK
@retval		D_DD_PMC_UART_INPUT_PARAM_ERROR	: Input parameter error
@remarks
			- Please call this API before setting the transmission data. 
*/
extern INT32 Dd_PMC_UART_Start( VP_CALLBACK psend_callback, VP_CALLBACK preceive_callback );

/**
Stop sending/receiving data(force stop)
@retval		D_DDIM_OK						: OK
@retval		D_DD_PMC_UART_INPUT_PARAM_ERROR	: Input parameter error
@remarks
			- If want to run again after running this API, please reconfigure Dd_PMC_UART_Ctrl().
			- Please call this API using the timer if want to stop the transfer.(in synchronous transfer)
 */
extern INT32 Dd_PMC_UART_Stop ( VOID );

/**
The transmission data specified by the argument is set to the register for the UART transmission.
@param [in]	put_char	Send data
@retval		D_DDIM_OK						: OK
@retval		D_DD_PMC_UART_INPUT_PARAM_ERROR	: Input parameter error
*/
extern INT32 Dd_PMC_UART_Put_Char( CHAR put_char );

/**
The data that wants to transmit to the transmission buffer is stored.<br>
When the transmission buffer overflows, the overflow error is sent back.
@param [in]	str		Send data
@retval		D_DDIM_OK						: OK
@retval		D_DD_PMC_UART_OVERFLOW_ERROR	: Overflow error
*/
extern INT32 Dd_PMC_UART_Set_Str( CHAR str );

/**
All the data that exists in the transmission buffer is transmitted.<br>
The error is sent back when there is no data in the transmission buffer.
@retval		D_DDIM_OK					: OK
@retval		D_DD_PMC_UART_NO_SEND_DATA	: It is the data none in transmission buffer
*/
extern INT32 Dd_PMC_UART_Put_Str( VOID );

/**
The receive data specified by the argument is get from the register for the UART reception.
 - When there is no receive data, "Receive data none" is sent back.
 - When the receive data storage area overflows, "Overflow Error" is sent back.
.
@param [in]	get_char		Receive data
@retval		D_DDIM_OK						: OK
@retval		D_DD_PMC_UART_INPUT_PARAM_ERROR	: Input parameter error
@retval		D_DD_PMC_UART_NO_RECEIVE		: Not received
@retval		D_DD_PMC_UART_OVERFLOW_ERROR	: Overflow error
*/
extern INT32 Dd_PMC_UART_Get_Char( CHAR* const get_char );

/**
Get the write pointer address of send buffer.
@return		write pointer address
*/
extern ULONG Dd_PMC_UART_Get_Send_Write_Pointer_Addr( VOID );

/**
Get the overlap count of send buffer.
@return		overlap count
*/
extern ULONG Dd_PMC_UART_Get_Send_Overlap_Count( VOID );

/**
Set the slave address(source)
@param [in]	slave_addr	Slave address(source)
@retval		D_DDIM_OK						: OK
@retval		D_DD_PMC_UART_INPUT_PARAM_ERROR	: Input parameter error
*/
extern INT32 Dd_PMC_UART_Set_Slave_Addr( UCHAR slave_addr );

/**
Send the slave address(target)
@param [in]	slave_addr	Slave address(target)
@retval		D_DDIM_OK						: OK
@retval		D_DD_PMC_UART_INPUT_PARAM_ERROR	: Input parameter error
@retval		D_DD_PMC_UART_MODE_UNMATCH		: Mode unmacth
@remarks
			- This API can be called in the following order:<br>
				Dd_PMC_UART_Ctrl() -> Dd_PMC_UART_Start()
				-> Dd_PMC_UART_Send_Target_Slave_Addr() -> Dd_PMC_UART_Set_Str() -> Dd_PMC_UART_Put_Str()<br>
			- If want to specify a slave of another communication and after a slave<br>
				communication end -> Dd_PMC_UART_Send_Target_Slave_Addr() -> Dd_PMC_UART_Set_Str() -> Dd_PMC_UART_Put_Str()<br>

*/
extern INT32 Dd_PMC_UART_Send_Target_Slave_Addr( UCHAR slave_addr );

/**
It is a function started when the UART transmission is completed.<br>
The callback function for the transmission registered by @ref Dd_PMC_UART_Ctrl is started.
*/
extern VOID	 Dd_PMC_UART_Int_Handler_Tx( VOID );

/**
It is a function started when the UART reception is completed.<br>
It is notified to start the callback function for the reception, and to have received it.
@remarks	The argument of the callback function is different according to Auto echo mode as follows.<br>
			- E_DD_PMC_UART_AUTO_ECHO_ON<br>
				&nbsp;&nbsp;&nbsp;&nbsp;Argument is reception result.<br>
				&nbsp;&nbsp;&nbsp;&nbsp;Please refer to Cast in the type of INT32.<br>
			- E_DD_PMC_UART_AUTO_ECHO_OFF<br>
				&nbsp;&nbsp;&nbsp;&nbsp;Argument is reception buffer.<br>
				&nbsp;&nbsp;&nbsp;&nbsp;After Cast in the type of INT32, please refer to Cast in the type of char.<br>
*/
extern VOID	 Dd_PMC_UART_Int_Handler_Rx( VOID );

#ifdef CO_DDIM_UTILITY_USE
//---------------------------- utility section ---------------------------
/**
The value specified by the simple argument is set to the register of UART.<br>
User entry function for transmission/reception specified by the argument is maintained.<br>
Reception buffer address/size of the reception buffer specified by the argument is assumed to be UART receive data storage area.<br>
The argument set with a fixed value is as follows.
 - Operation mode				: Asynchronous, normal mode
 - Operation clock				: Internal clock
 - Transferring Direction		: LSB first
 - Inversion serial data format	: NRZ
 - FIFO Setting					: Not use
 - Send callback function		: NULL
.
@param [in]	uart_mng_simple	UART simple control table. See @ref T_DD_PMC_UART_MNG_SIMPLE.
@retval		D_DD_OK							: OK
@retval		D_DD_PMC_UART_INPUT_PARAM_ERROR	: Input parameter error
*/
extern	INT32	Dd_PMC_UART_Initialize_Simple( T_DD_PMC_UART_MNG_SIMPLE const *const uart_mng_simple);

//---------------------------- colabo section ----------------------------
/**
All the data that exists in the transmission buffer is transmitted via DMA and UART FIFO.<br>
The error is sent back when there is no data in the transmission buffer.
@param [in]	dma_ch	DMA channel number(0 to 7)
@retval		D_DDIM_OK					: OK
@retval		D_DD_PMC_UART_NO_SEND_DATA	: It is the data none in transmission buffer
*/
extern INT32 Dd_PMC_UART_Put_Str_DMA( UCHAR dma_ch );
#endif // CO_DDIM_UTILITY_USE

#ifdef __cplusplus
}
#endif

/* @} */	// dd_pmc_uart_api group

#endif	// 
